package com.vitabuybuy.tv.ui.mine.order.adapter

import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.vitabuybuy.tv.R
import com.vitabuybuy.tv.databinding.ItemLogisticsBinding
import com.vitabuybuy.tv.dto.LogisticsDto
import com.library.common.base.BindRecycAdapter

class LogisticsInforAdapter : BindRecycAdapter<ItemLogisticsBinding, LogisticsDto.ExpressBean>() {
    override fun normalViewId(viewType: Int): Int {
        return R.layout.item_logistics
    }
    override fun onBindViewHolder(binding: ItemLogisticsBinding, itemData: LogisticsDto.ExpressBean, holder: RecyclerView.ViewHolder, position: Int) {
        binding.itemBean = itemData
        // 第一个位置
        if (position == 0) {
            binding.stepView.changeFirstStyle()
            binding.tvName.setTextColor(ContextCompat.getColor(mContext,R.color.mainColor))
            binding.tvTime.setTextColor(ContextCompat.getColor(mContext,R.color.mainColor))
        } else {
            // 最后一个位置
            if (position == itemCount - 1) {
                binding.stepView.changeEndStyle()
            } else {
                binding.stepView.changeNormalStyle()
            }
            binding.tvName.setTextColor(ContextCompat.getColor(mContext,R.color.text_909298))
            binding.tvTime.setTextColor(ContextCompat.getColor(mContext,R.color.text_909298))
        }
    }
}
